#include <stdio.h>
#include <string.h>

int main() 
{
    char str[] = "apple; banana, hello.xiaodu hello:world";
    const char delimiters[] = ",;.: "; // 逗号、分号、句点、冒号、空格
    
    printf("原始字符串: %s\n", str);
    printf("分隔符: '%s'\n\n", delimiters);
    //第一次调用传入要分割的字符串，后续调用传入 NULL
    char *token = strtok(str, delimiters);
    int count = 0;
    
    while (token != NULL)
    {
        printf("token %d: '%s'\n", ++count, token);
        token = strtok(NULL, delimiters);
    }
    
    return 0;
}
